<?php
Yii::app()->clientScript->registerScriptFile($this->adminPath."/js/jquery.min.js",CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScriptFile($this->adminPath."/js/art-dialog/jquery.artDialog.js",CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScriptFile($this->adminPath."/js/art-dialog/plugins/iframeTools.js",CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScriptFile($this->adminPath."/js/jquery-ui-1.8.11.custom.min.js",CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScriptFile($this->adminPath."/js/jquery.validationEngine.js",CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScriptFile($this->adminPath."/js/jquery.validationEngine-zh_CN.js",CClientScript::POS_HEAD);

?>
    <link rel="stylesheet" type="text/css" href="<?php echo $this->adminPath; ?>/css/jquery-ui.css" />
    <link rel="stylesheet" type="text/css" href="<?php echo $this->adminPath; ?>/js/art-dialog/skins/blue.css" />
    <link rel="stylesheet" type="text/css" href="<?php echo $this->adminPath; ?>/css/validationEngine.jquery.css" />
    <!-- page title -->
    <div class="page-title" style="z-index: 780;">
        <div class="in" style="z-index: 770;">
            <div class="titlebar" style="z-index: 760;">
                <h2 class="title">3G管理</h2>
                <p>设置微信端账号</p></div>
            <div class="clear" style="z-index: 740;"></div>
        </div>
    </div>
    <style>
        .grid-view {
            padding: 0;
        }
        table.tablesorters {
            background-color: #CDCDCD;
            font-family: arial;
            font-size: 12px;
            margin: 0 0;
            text-align: left;
            width: 100%;
        }
        table.tablesorters thead tr th {
            background-position: right center;
            background-repeat: no-repeat;
            color: #333333;
            cursor: pointer;
        }
        table.tablesorters tbody td {
            padding: 12px;
            vertical-align: middle;
        }
        table.tablesorters tbody td {
            border: 1px solid #D8E4E9;
            color: #6C7D8C;
            padding: 12px;
            vertical-align: top;
        }
        table.tablesorters thead tr th, table.tablesorter tfoot tr th {
            -moz-border-bottom-colors: none;
            -moz-border-left-colors: none;
            -moz-border-right-colors: none;
            -moz-border-top-colors: none;
            background: url("<?php echo $this->adminPath; ?>/img/tableshorter/titlebg.png") repeat-x scroll center bottom #EFF3F8;
            border-color: -moz-use-text-color #CBDAE8;
            border-image: none;
            border-left: 1px solid #CBDAE8;
            border-right: 1px solid #CBDAE8;
            border-style: none solid;
            border-width: medium 1px;
            font-size: 8pt;
            padding: 12px;
        }
        table.tablesorters tbody tr.odd {
            background-color: #FFFFFF;
        }
        table.tablesorters tbody tr:hover {
            background-color: #E4ECF3;
        }
        .newLoding{
            background: url("<?php echo $this->adminPath; ?>/img/loading/6.gif") no-repeat scroll center bottom #EFF3F8;
        }
        .page.selected a{
            background:#3E7CAC ;
            color:#FFFFFF;
        }
        .grid-view .button-column {
            text-align: center;
            width: 30px;
        }
    </style>

    <div class="content">
        <div class="simplebox grid740" style="z-index: 500;">

            <div class="titleh" style="z-index: 490;">
                <h3>3G管理</h3>
            </div>
            <form id="form"  method="post" >
            <div class="st-form-line" style="z-index: 580;">
                <span class="st-labeltext">状态:</span>
                <?php if($info->status){ ?>
                <?php if($info->status==1){ ?>
                    <em style="color: green;">正在使用</em>
                <?php }elseif($info->status==0){ ?>
                    <em style="color: red;">已被总管理员暂停使用</em>
                <?php } ?>
                <?php }else{ ?>
                    暂无设置 请生成
                <?php }?>
                <div class="clear" style="z-index: 570;"></div>
            </div>
            <div class="st-form-line" style="z-index: 580;">
                <span class="st-labeltext">微信前端页面地址:</span>
                <?php if($info->user_token){ ?>
                    <?php echo Yii::app()->createAbsoluteUrl('index/index'); ?>
                <?php }else{ ?>
                    暂无设置 请生成
                <?php }?>
                <div class="clear" style="z-index: 570;"></div>
            </div>
            <?php if($info->user_token){ ?>
            <div class="st-form-line" style="z-index: 580;">
                <span class="st-labeltext">微信端二维码:</span>
                <img src="<?php echo Yii::app()->createAbsoluteUrl('admin/wap/getCode'); ?>">
                <div class="clear" style="z-index: 570;"></div>
            </div>
            <?php }?>


            <div class="st-form-line" style="z-index: 580;">
                <span class="st-labeltext">公众号TOKEN:</span>
                <?php if($info->wx_token){ ?>
                    <?php echo $info->wx_token; ?>
                <?php }else{ ?>
                    暂无设置 请生成
                <?php }?>

                <div class="clear" style="z-index: 570;"></div>
            </div>
            <div class="st-form-line" style="z-index: 580;">
                <span class="st-labeltext">公众号原始ID:</span>
                <input type="text" value="<?php echo $info->wx_guid; ?>"  name="wx_guid" style="width:300px;margin-bottom: 10px;float: left" id="wx_guid" class="st-success-input validate[required,maxSize[60]]"  data-errormessage-range-overflow="原始ID不得大于60个字">
                <div class="clear" style="z-index: 570;"></div>
            </div>
            <div class="st-form-line" style="z-index: 580;">
                <span class="st-labeltext">公众号名称:</span>
                <input type="text" value="<?php echo $info->wx_name; ?>"  name="wx_name" style="width:300px;margin-bottom: 10px;float: left" id="wx_name" class="st-success-input validate[required,maxSize[60]]"  data-errormessage-range-overflow="公众号名不得大于60个字">
                <div class="clear" style="z-index: 570;"></div>
            </div>
            <div class="st-form-line" style="z-index: 580;">
                <span class="st-labeltext">微信号:</span>
                <input type="text" value="<?php echo $info->wx_id; ?>"  name="wx_id" style="width:300px;margin-bottom: 10px;float: left" id="wx_id" class="st-success-input validate[maxSize[60]]"  data-errormessage-range-overflow="微信号不得大于60个字">
                <div class="clear" style="z-index: 570;"></div>
            </div>
            <div class="st-form-line" style="z-index: 580;">
                <span class="st-labeltext">AppID(应用ID):</span>
                <input type="text" value="<?php echo $info->wx_app_id; ?>"  name="wx_app_id" style="width:300px;margin-bottom: 10px;float: left" id="wx_app_id" class="st-success-input validate[required,maxSize[60]]"  data-errormessage-range-overflow="应用ID不得大于60个字">
                <div class="clear" style="z-index: 570;"></div>
            </div>
            <div class="st-form-line" style="z-index: 580;">
                <span class="st-labeltext">AppSecret(应用密钥):</span>
                <input type="text" value="<?php echo $info->wx_app_secret; ?>"  name="wx_app_secret" style="width:300px;margin-bottom: 10px;float: left" id="wx_app_secret" class="st-success-input validate[required,maxSize[60]]"  data-errormessage-range-overflow="应用密钥不得大于60个字">
                <div class="clear" style="z-index: 570;"></div>
            </div>
            <div class="st-form-line" style="z-index: 580;">
                <span class="st-labeltext">公司电话:</span>
                <input type="text" value="<?php echo $info->company_phone; ?>"  name="company_phone" style="width:300px;margin-bottom: 10px;float: left" id="company_phone" class="st-success-input validate[maxSize[20]]"  data-errormessage-range-overflow="公司电话不得大于20个字">
                <div class="clear" style="z-index: 570;"></div>
            </div>
            <div style="z-index: 770;" class="albox succesbox">
                <span  style="color: red;">web站 可以脱离微信独立存在  信息存在为cookie+localStorage</span><br/>
                <span  style="color: green;">订阅号 用户唯一标识通过第三方平台传入 本平台获取url【网址】的唯一标识 如果不存在唯一标识再通过cookie+localStorage取得登录信息</span><br/>
                <span  style="color: blue;">服务号 用户唯一标识通过本平台获取 账号类型必须为服务号，需在公众平台设置获取用户信息域名以及JS SDK域名</span>

            </div>
            <div class="st-form-line" style="z-index: 620;">
                <span class="st-labeltext">网站类型:</span>
                <li style="display:inline-block;width:120px;">
                    <input type="radio" name="is_type" <?php if($info->is_type==1){ ?>checked="checked"<?php } ?> value="1" >
                    <label for="WedoShl_status_0">web站</label>
                </li>
                <li style="display:inline-block;width:120px;">
                    <input type="radio" name="is_type" <?php if($info->is_type==2){ ?>checked="checked"<?php } ?> value="2" >
                    <label for="WedoShl_status_0">订阅号</label>
                </li>
                <li style="display:inline-block;width:120px;">
                    <input type="radio" name="is_type" <?php if($info->is_type==3){ ?>checked="checked"<?php } ?> value="3" >
                    <label for="WedoShl_status_0">服务号</label>
                </li>
                <div class="clear" style="z-index: 610;"></div>
            </div>





            <?php if($info){ ?>
                <div class="st-form-line button-box" style="z-index: 460;">
                    <input type="submit" class="st-button" value="保存" id="submit" name="button">
                </div>
            <?php }else{ ?>
                <div class="st-form-line button-box" style="z-index: 460;">
                    <input type="submit" class="st-button" value="生成" id="submit" name="button">
                </div>
            <?php } ?>
            </form>
        </div>
    </div>
<script type="text/javascript">
    $(function(){
        $("#form").validationEngine({
            ajaxFormValidation: true,
            ajaxFormValidationURL: '<?php echo Yii::app()->createAbsoluteUrl('admin/wap/addApp'); ?>',
            ajaxFormValidationMethod: "post",
            //validateNonVisibleFields:true,//验证隐藏字段
            onBeforeAjaxFormValidation: function (form, options) {
                art.dialog.Talert('数据交互中ing', 5);
            },
            onAjaxFormComplete: function (status, form, json, options) {
                if (json['status'] == 1) {
                    art.dialog.Talert(json['message']);
                    window.location.reload();
                } else {
                    art.dialog.Talert(json['message']);
                }
            }

        });
    });
</script>